function MapLoader () {   // <-- 原作者这里使用的是module.exports
  return new Promise((resolve, reject) => {
    if (window.TMap) {
      resolve(window.TMap)
    } else {
      var script = document.createElement('script')
      script.type = 'text/javascript'
      script.async = true
      script.src = 'https://map.qq.com/api/gljs?v=1.exp&key=QHQBZ-74AK5-PXIIR-IQBOP-7APDJ-XRBXP'
      script.onerror = reject
      document.head.appendChild(script)
    }
    window.initTMap = () => {
      resolve(window.TMap)
    }
  })
}

export default MapLoader